From 0415a75d23bba11eda861e805600f90b483a0329 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Tue, 11 Dec 2007 10:14:11 -0700 Subject: [PATCH] [IA64] Fix LOAD_PHYSICAL for INIT handler Xen virtual address space moves to 0xf400000004000000. So LOAD_PHYSICAL is broken. I fixed LOAD_PHYSICAL with ia64 patch. This patch also fixes INIT handler. Signed-off-by: Akio Takebe --- xen/arch/ia64/linux-xen/setup.c | 2 -- xen/arch/ia64/xen/xenpatch.c | 24 +++++++++++++++++++ xen/include/asm-ia64/linux-xen/asm/asmmacro.h | 8 ------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/xen/arch/ia64/linux-xen/setup.c b/xen/arch/ia64/linux-xen/setup.c index 710b6e4b69..6a0964534c 100644 --- a/xen/arch/ia64/linux-xen/setup.c +++ b/xen/arch/ia64/linux-xen/setup.c @@ -500,9 +500,7 @@ setup_arch (char **cmdline_p) { unw_init(); -#ifndef XEN ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist); -#endif *cmdline_p = __va(ia64_boot_param->command_line); #ifndef XEN diff --git a/xen/arch/ia64/xen/xenpatch.c b/xen/arch/ia64/xen/xenpatch.c index 3719137160..f9c9f9cafc 100644 --- a/xen/arch/ia64/xen/xenpatch.c +++ b/xen/arch/ia64/xen/xenpatch.c @@ -106,6 +106,30 @@ static void __init xen_patch_frametable_miss(u64 offset) #endif } +/* + * We need sometimes to load the physical address of a kernel + * object. Often we can convert the virtual address to physical + * at execution time, but sometimes (either for performance reasons + * or during error recovery) we cannot to this. Patch the marked + * bundles to load the physical address. + */ +void __init +ia64_patch_vtop (unsigned long start, unsigned long end) +{ + s32 *offp = (s32 *)start; + u64 ip; + + while (offp < (s32 *)end) { + ip = (u64)offp + *offp; + + /* replace virtual address with corresponding physical address */ + ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip))); + ia64_fc((void *)ip); + ++offp; + } + ia64_sync_i(); + ia64_srlz_i(); +} void __init xen_patch_kernel(void) { diff --git a/xen/include/asm-ia64/linux-xen/asm/asmmacro.h b/xen/include/asm-ia64/linux-xen/asm/asmmacro.h index 4549cc8637..73c51e2bc4 100644 --- a/xen/include/asm-ia64/linux-xen/asm/asmmacro.h +++ b/xen/include/asm-ia64/linux-xen/asm/asmmacro.h @@ -59,17 +59,9 @@ name: .section ".data.patch.vtop", "a" // declare section & section attributes .previous -#ifdef XEN -#define LOAD_PHYSICAL(pr, reg, obj) \ -[1:](pr)movl reg = obj;; \ - shl reg = reg,4;; \ - shr.u reg = reg,4;; \ - .xdata4 ".data.patch.vtop", 1b-. -#else #define LOAD_PHYSICAL(pr, reg, obj) \ [1:](pr)movl reg = obj; \ .xdata4 ".data.patch.vtop", 1b-. -#endif /* * For now, we always put in the McKinley E9 workaround. On CPUs that don't need it, -- 2.30.2